document.write('<link href="/plug-in/mCustomScrollbar/jquery.mCustomScrollbar.css" rel="stylesheet">');
document.title = '北京鲲博时代信息科技有限公司';
// 解决ie9及以下不兼容ajax
jQuery.support.cors = true;
$('ul.hoverTabBox li').mouseover(function(){
	$(this).addClass('index').siblings().removeClass('index')
	$(this).parent().siblings('div.hoverShow').removeClass('index')
	$(this).parent().siblings('div.hoverShow').eq($(this).index()).addClass('index')
})
var headerHtml = '';
headerHtml += '<div class="logo"><a href="/index.html"><img src="/images/logo.svg"></a></div><ul>'
headerHtml += '<li class="active"><a href="/index.html">首页</a></li>'
headerHtml += '<li><a href="/html/manufacturing.html">智能制造</a></li>'
headerHtml += '<li><a href="/html/internet.html">工业互联网</a></li>'
headerHtml += '<li><a href="/html/iot.html">智慧物联</a></li>'
headerHtml += '<li><a href="/html/bim.html">智慧运维</a></li>'
headerHtml += '<li><a href="/html/metering.html">智能计量</a></li>'
headerHtml += '<li><a href="/html/teach.html">教学一体化</a></li>'
headerHtml += '<li class="app"><a href="javascript:void(0)">产品分类</a>'
headerHtml += '</li>'
headerHtml += '<li><a href="/html/about.html">关于我们</a></li>'
headerHtml += '</ul><div class="phone">010-67440612</div>'
$('.header').html(headerHtml)
$('.header ul li').eq(nav).addClass('active').siblings().removeClass('active');
$.ajax({
	type: 'get',
	dataType: 'json',
	url: 'http://liudashi2006.eicp.net:4000/cms/v2/baseData/list',
	data: {
		parentId: 3,
		name: '文章大类'
	},
	error: function(e) {
		console.log(e)
	},
	success: function(data) {
		var myData = data.data
		var ulHtml = ''
		ulHtml += '<div class="ul content"><div class="box">';
		for (var i = 0; i < myData.length; i++) {
			ulHtml += '<div class="li" id="menu' + myData[i].id + '"><div class="title" id="' + myData[i].id + '">' + myData[i].itemName + '</div><div class="artConet"></div>';
			ulHtml += '	</div>';
			getArticle(myData[i].id)
		}
		ulHtml += '</div></div>';
		$('body').append(ulHtml);
		$('.header ul li.app').hover(function(){
			$('div.ul').show()
		},function(){
		})
		$('div.ul').hover(function(){
			$('div.ul').show()
		},function(){
			$('div.ul').hide()
		})
	}
})
// 获取文章标题
function getArticle (id) {
	$.ajax({
		type: 'get',
		dataType: 'json',
		url: 'http://liudashi2006.eicp.net:4000/cms/v2/article/list',
		data: {
			artType: id
		},
		error: function(e) {
			console.log(e)
		},
		success: function(article) {
			var articleList = article.data;
			var artHtml = '';
			for (var a = 0; a < articleList.length; a++) {
				artHtml +='<div class="dt"><a href="/html/product-detail.html?id=' + articleList[a].id + '">' + articleList[a].title + '</a></div>';
			}
			$('div#menu' + id).children('div.artConet').html(artHtml)
		}
	})
}
$(window).scroll(function(){
	topGo()
});
topGo()
function topGo () {
	var height = $('.banner').height() - 60
	// 滚动条滚动
	var isTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;// (获取屏幕滚动高度)
	if(isTop > height){
		$('.header').css('background', '#2D2D2D')
		// $('.header ul li div.ul').css('background', 'rgba(0,0,0,.8)')
	}
	else {
		$('.header').css('background', 'none')
		// $('.header ul li div.ul').css('background', 'rgba(255,255,255,.8)')
	}
}
function bannerPlay () {
	$('.swiper-container').css('height', $('.swiper-slide >img').height())
	// 轮播图
	var mySwiper = new Swiper ('.swiper-container', {
	  loop: true,
	  autoplay: 5000,
	  autoplayDisableOnInteraction: false,
		pagination : '.pagination',
		paginationClickable: true
	  // nextButton: '.swiper-button-next',
	  // prevButton: '.swiper-button-prev',
		// createPagination: true,
		// paginationClickable :true
	})
	$('.swiper-container').hover(function(){
		$('.swiper-button-next').show()
		$('.swiper-button-prev').show()
	},function(){
		$('.swiper-button-next').hide()
		$('.swiper-button-prev').hide()
	})
}
function getIndex() {
	for (var i = 0; i < $('.swiper-pagination-switch').length; i++) {
		if ($('.swiper-pagination-switch').eq(i).hasClass('swiper-active-switch') === true) {
			return i;
		}
	}
}
function getUrlParam(name){
  var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  var r = window.location.search.substr(1).match(reg);  //匹配目标参数
  if (r!=null) return decodeURI(r[2]); return null; //返回参数值
}
